/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode(int x) { val = x; }
 * }
 */
class Solution {
    int maxDeff = 0;
    public int maxDepth(TreeNode root) {
        int deff = 1;
        if(root == null) {
            return 0;
        }
        dfc(root,deff);
        return maxDeff;
    }

    public void dfc(TreeNode root,int deff) {
        if(root == null) {
            return;
        }
        maxDeff = Math.max(maxDeff,deff);
        dfc(root.left,deff+1);
        dfc(root.right,deff+1);
    }
}